home *** CD-ROM | disk | FTP | other *** search
- /*
- * FCntl.h -- faccess(), fcntl(), and open() mode flags
- *
- * Portions copyright American Telephone & Telegraph
- * Used with permission, Apple Computer Inc. (1985,1988,1990,1992-1994)
- * All rights reserved.
- *
- * Warning: This interface is NOT a part of the ANSI C standard.
- * We do NOT claim to be POSIX compliant.
- * If you want your code to be portable, don't use this interface.
- */
-
- #ifndef __FCNTL__
- #define __FCNTL__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifndef __ALIASES__
- #include <Aliases.h>
- #endif
-
- /*
- * For use by lseek():
- */
-
- #ifndef __STDIO__ /* these defns exactly paralled in StdIO.h for fseek() */
- #define SEEK_CUR 1
- #define SEEK_END 2
- #define SEEK_SET 0
- #endif
-
- /*
- * faccess() commands; for general use
- */
- /* 'd' => "directory" ops */
- #define F_DELETE (('d'<<8)|0x01)
- #define F_RENAME (('d'<<8)|0x02)
-
- /*
- * more faccess() commands; for use only by MPW tools
- */
-
- #define F_OPEN (('d'<<8)|0x00) /* reserved for operating system use */
- /* 'e' => "editor" ops */
- #define F_GTABINFO (('e'<<8)|0x00) /* get tab offset for file */
- #define F_STABINFO (('e'<<8)|0x01) /* set " " " " */
- #define F_GFONTINFO (('e'<<8)|0x02) /* get font number and size for file */
- #define F_SFONTINFO (('e'<<8)|0x03) /* set " " " " " " */
- #define F_GPRINTREC (('e'<<8)|0x04) /* get print record for file */
- #define F_SPRINTREC (('e'<<8)|0x05) /* set " " " " */
- #define F_GSELINFO (('e'<<8)|0x06) /* get selection information for file */
- #define F_SSELINFO (('e'<<8)|0x07) /* set " " " " */
- #define F_GWININFO (('e'<<8)|0x08) /* get current window position */
- #define F_SWININFO (('e'<<8)|0x09) /* set " " " */
- #define F_GSCROLLINFO (('e'<<8)|0x0A) /* get scroll information */
- #define F_SSCROLLINFO (('e'<<8)|0x0B) /* set " " */
- #define F_GMARKER (('e'<<8)|0x0D) /* Get Marker */
- #define F_SMARKER (('e'<<8)|0x0C) /* Set " */
- #define F_GSAVEONCLOSE (('e'<<8)|0x0F) /* Get Save on close */
- #define F_SSAVEONCLOSE (('e'<<8)|0x0E) /* Set " " " */
-
- /*
- * argument structure for use with F_SMARKER command
- */
- #ifdef powerc
- #pragma options align=mac68k
- #endif
- struct MarkElement {
- int start; /* start position of mark */
- int end; /* end position */
- unsigned char charCount; /* number of chars in mark name */
- char name[64]; /* marker name */
- }; /* note: marker may be up to 64 chars long */
-
- #ifdef powerc
- #pragma options align=reset
- #endif
-
- #ifndef __cplusplus
- typedef struct MarkElement MarkElement;
- #endif
-
- #ifdef powerc
- #pragma options align=mac68k
- #endif
- struct SelectionRecord {
- long startingPos;
- long endingPos;
- long displayTop;
- };
- #ifdef powerc
- #pragma options align=reset
- #endif
- #ifndef __cplusplus
- typedef struct SelectionRecord SelectionRecord;
- #endif
-
- /*
- * Mode values accessible to open()
- */
-
- #define O_RDONLY 0 /* Bits 0 and 1 are used internally */
- #define O_WRONLY 1 /* Values 0..2 are historical */
- #define O_RDWR 2 /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */
- #define O_APPEND (1<< 3) /* append (writes guaranteed at the end) */
- #define O_RSRC (1<< 4) /* Open the resource fork */
- #define O_ALIAS (1<< 5) /* Open alias file */
- #define O_CREAT (1<< 8) /* Open with file create */
- #define O_TRUNC (1<< 9) /* Open with truncation */
- #define O_EXCL (1<<10) /* w/ O_CREAT: Exclusive "create-only" */
- #define O_BINARY (1<<11) /* Open as a binary stream */
- #define O_NRESOLVE (1<<14) /* Don't resolve any aliases */
-
- /*
- * fcntl() commands
- */
- #define F_DUPFD 0 /* Duplicate files (file descriptor) */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*
- * function prototypes
- */
-
- #ifdef __CFM68K__
- #ifdef UsingSharedLibs
- #pragma lib_export on
- #endif
- #endif
-
- int close(int);
- int creat(const char*);
- int dup(int filedes); /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */
- int faccess(char*, unsigned int, long*);
- int fcntl(int, unsigned int, int);
- long lseek(int, long, int);
- int open(const char*, int);
- int read(int, char*, unsigned);
- int unlink(char*);
- int write(int, const char*, unsigned);
- OSErr ResolveFolderAliases (
- /* Info in */ short volume, long directory, StringPtr path, Boolean resolveLeafAlias,
- /* Info out */ FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
- OSErr MakeResolvedFSSpec (short volume, long directory, StringPtr path,
- FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias,
- Boolean *leafIsAlias);
- OSErr ResolvePath (char *rawPath, char *resolvedPath, Boolean *isFolder, Boolean *hadAlias);
- OSErr MakeResolvedPath (short volume, long directory, StringPtr path, Boolean resolveLeafAlias,
- char *buffer, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
- pascal Boolean TrapAvailable (short TrapNumber);
-
- #ifdef __CFM68K__
- #ifdef UsingSharedLibs
- #pragma lib_export off
- #endif
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __FCNTL__ */
-